<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/chiptrack-tags.tld" prefix="chiptrack" %>

<chiptrack:checkLogon sourcePage="/settingForecast.do"/>

<%@ page import="com.scalar.chiptrack.users.User,
                com.scalar.chiptrack.users.UserGroup,
                com.scalar.chiptrack.marketing.MarketingForecast,
                com.scalar.chiptrack.marketing.dao.MarketingDAO,
                com.scalar.chiptrack.commons.SessionKeys,
                com.scalar.chiptrack.utils.StringUtils,
                com.scalar.chiptrack.utils.ConfigManager,
                 com.scalar.chiptrack.commons.Constants,
                 org.apache.struts.util.LabelValueBean,
                 java.util.*"%>

<HTML><HEAD><TITLE>Scalarsoft - ChipTrac</TITLE>

<%String chipTracContext = "/" + ConfigManager.getChipTracContext();%>

<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<LINK href="<%=chipTracContext%>/jsp/includes/stylesheets/scalarsoft.css" type=text/css rel=stylesheet>

<META content="MSHTML 5.50.4807.2300" name=GENERATOR></HEAD>
<BODY bgColor="#ffffff" leftMargin=0 topMargin=0 marginheight="0" marginwidth="0">
<script src="<%=chipTracContext%>/jsp/includes/scripts/functions.js">
</script>
<SCRIPT language="JavaScript" src="<%=chipTracContext%>/jsp/includes/scripts/validations.js">
</script>

<SCRIPT language="JavaScript">
var prevPrice = 0;
    function submitPage()
    {
        var errors = '';
        var price = document.settingForecastForm["unitPrice"];
        var qty = document.settingForecastForm["qty"];

        for( i = 0; i < settingForecastForm.monthCount.value; i++)
        {   if(price.length == null)
            {
                if( price.value != '')
                {
                    var j = 0;
                    for(var k = 0; k < (price.value).length;k++)
                    {
                        var c = (price.value).charAt(k);
                        if( c == '.' )
                        {
                            j++;
                            if(j > 1 )
                            {
                                errors = errors +'<br>' + "<li>  Please enter a valid price";
                                price.select();
                                break;
                            }
                        }
                     }
                }
                else
                {
                    price.value = "0.0"
                }
            }
            else
            {
                if( price[i].value != '')
                {
                    var j = 0;
                    for(var k = 0; k < (price[i].value).length;k++)
                    {
                        var c = (price[i].value).charAt(k);
                        if( c == '.' )
                        {
                            j++;
                            if(j > 1 )
                            {
                                errors = errors +'<br>' + "<li>  Please enter a valid price";
                                price[i].select();
                                break;
                            }
                        }
                    }
                    if(check_char_position4(price[i].value) || (is_Sp_Characters_frieght(price[i].value) == false)  )
                    {
                         errors = errors +'<br>' + "<li>  Please enter a valid price";
                         price[i].select();
                         break;
                    }
                }
                else
                {
                    price[i].value = "0.0"
                }
            }
            if(qty.length == null)
            {
                if( qty.value != '')
                {
                    if( !isInteger(qty.value) )
                    {
                         errors = errors +'<br>' + "<li>  Please enter a valid Quantity";
                         qty.select();
                         break;
                    }
                }
                else
                {
                    qty.value = "0"
                }
             }
             else
             {
                 if( qty[i].value != '')
                {
                    if( !isInteger(qty[i].value) )
                    {
                         errors = errors +'<br>' + "<li>  Please enter a valid Quantity";
                         qty[i].select();
                         break;
                    }
                }
                else
                {
                    qty[i].value = "0"
                }
             }
            if( document.settingForecastForm["confidenceLevel"] != null )
            {
                confidenceLevel = document.settingForecastForm["confidenceLevel"];
                if(confidenceLevel.length == null)
                {
                    if( confidenceLevel.value != '')
                    {

                        var j = 0;
                        for(var k = 0; k < (confidenceLevel.value).length; k++)
                        {
                            var c = (confidenceLevel.value).charAt(k);
                            if( c == '.' )
                            {
                                j++;
                                if(j > 1 )
                                {
                                    errors = errors +'<br>' + "<li>  Please enter a valid Confidence Level";
                                    confidenceLevel.select();
                                    break;
                                }
                            }
                        }
                        if(check_char_position4(confidenceLevel.value) || (is_Sp_Characters_frieght(confidenceLevel.value) == false)  )
                        {
                             errors = errors +'<br>' + "<li>  Please enter a valid Confidence Level";
                             confidenceLevel.select();
                             break;
                        }
                        if( confidenceLevel.value > 100 )
                        {
                             errors = errors +'<br>' + "<li>  Please enter the Confidence Level less than or equal to 100";
                             confidenceLevel.select();
                             break;
                        }
                    }
                    else
                    {
                        confidenceLevel.value = "100.0"
                    }
                }
                else
                {
                    if( confidenceLevel[i].value != '')
                    {

                        var j = 0;
                        for(var k = 0; k < (confidenceLevel[i].value).length; k++)
                        {
                            var c = (confidenceLevel[i].value).charAt(k);
                            if( c == '.' )
                            {
                                j++;
                                if(j > 1 )
                                {
                                    errors = errors +'<br>' + "<li>  Please enter a valid Confidence Level";
                                    confidenceLevel[i].select();
                                    break;
                                }
                            }
                        }
                        if(check_char_position4(confidenceLevel[i].value) || (is_Sp_Characters_frieght(confidenceLevel[i].value) == false)  )
                        {
                            errors = errors +'<br>' + "<li>  Please enter a valid Confidence Level";
                            confidenceLevel[i].select();
                            break;
                        }
                        if( confidenceLevel[i].value > 100 )
                        {
                            errors = errors +'<br>' + "<li>  Please enter the Confidence Level less than or equal to 100";
                            confidenceLevel[i].select();
                            break;
                        }
                    }
                    else
                    {
                        confidenceLevel[i].value = "100.0"
                    }
                }
            }
        }

        if( !isInteger( document.settingForecastForm.monthCount.value ) )
        {
             errors = errors +'<br>' + "<li>  Please enter a valid Months";
             document.settingForecastForm.monthCount.select();
        }
        if(errors != '')
        {
            pa=document.getElementById("font1");
            pa.innerHTML = errors;
            return;
        }
        if(document.settingForecastForm.qty.length == null)
        {
                document.settingForecastForm.qty.disabled = false;
                document.settingForecastForm.unitPrice.disabled = false;
                if( document.settingForecastForm["confidenceLevel"] != null )
                {
                    document.settingForecastForm.confidenceLevel.disabled = false;
                }

       }
       else
       {
            for(i=0;i < settingForecastForm.monthCount.value;i++)
            {
                document.settingForecastForm.qty[i].disabled = false;
                document.settingForecastForm.unitPrice[i].disabled = false;
                if( document.settingForecastForm["confidenceLevel"] != null )
                {
                    document.settingForecastForm.confidenceLevel[i].disabled = false;
                }
            }
       }
        document.settingForecastForm.action.value = "saveForecast";
        document.settingForecastForm.submit();
    }


    function loadSalesForecast()
    {
        var productId  = document.settingForecastForm.product.value;
        var customerId = document.settingForecastForm.customer.value;
        var monthId    = document.settingForecastForm.startMonth.value;
        var yearId     = document.settingForecastForm.year.value;

        var price           = document.settingForecastForm["unitPrice"];
        var qty             = document.settingForecastForm["qty"];

        var errors = '';
        if (productId == '-1')
        {
            errors = '<li> Please select the product';
        }
        if (customerId == '-1')
        {
            errors = errors + '<br>' + '<li> Please select the customer';
        }
        if (monthId == '-1')
        {
            errors = errors + '<br>' + '<li> Please select the Start Month';
        }
        if (yearId == '-1')
        {
            errors = errors + '<br>' + '<li> Please select the Year';
        }
        if( !isInteger( document.settingForecastForm.monthCount.value ) )
        {
             errors = errors +'<br>' + "<li>  Please enter a valid Months";
             document.settingForecastForm.monthCount.select();
        }
        if(errors != '')
        {
            pa=document.getElementById("font1");
            pa.innerHTML = errors;
            return;
        }

        if( qty.length == null)
        {
            qty.disabled = false;
            price.disabled = false;
            if( document.settingForecastForm["confidenceLevel"] != null )
            {
                document.settingForecastForm.confidenceLevel.disabled = false;
            }
        }
        else
        {
            for(i=0;i < settingForecastForm.monthCount.value;i++)
            {
                qty[i].disabled = false;
                price[i].disabled = false;
                if( document.settingForecastForm["confidenceLevel"] != null )
                {
                    document.settingForecastForm.confidenceLevel[i].disabled = false;
                }
            }
        }
        document.settingForecastForm.action.value = "loadForecast";
        document.settingForecastForm.submit();

    }
    function loadMarketingForecast()
    {
        var productId  = document.settingForecastForm.product.value;
        var customerId = document.settingForecastForm.customer.value;
        var monthId    = document.settingForecastForm.startMonth.value;
        var yearId     = document.settingForecastForm.year.value;
        var monthCount = document.settingForecastForm.monthCount.value

        var price           = document.settingForecastForm["unitPrice"];
        var qty             = document.settingForecastForm["qty"];

        var errors = '';


        if (productId == '-1')
        {
            errors = '<li> Please select the product';
        }
        if (monthId == '-1')
        {
            errors = errors + '<br>' + '<li> Please select the Start Month';
        }
        if (yearId == '-1')
        {
            errors = errors + '<br>' + '<li> Please select the Year';
        }
        if( !isInteger( document.settingForecastForm.monthCount.value ) )
        {
             errors = errors +'<br>' + "<li>  Please enter a valid Months";
             document.settingForecastForm.monthCount.select();
        }
        if(errors != '')
        {
            pa=document.getElementById("font1");
            pa.innerHTML = errors;
            return;
        }

        if( qty.length == null)
        {
            qty.disabled = false;
            price.disabled = false;
        }
        else
        {
            for(i=0;i < settingForecastForm.monthCount.value;i++)
            {
                qty[i].disabled = false;
                price[i].disabled = false;
            }
        }

        document.settingForecastForm.action.value = "loadForecast";
        document.settingForecastForm.submit();

    }
    function restrictCharactersAndDot()
    {
        if (event.keyCode < 48 || event.keyCode > 57 )
	    {
		    event.returnValue = false;
	    }
    }

    function openWindow()
    {
        newWindow = window.open('<%=chipTracContext%>/uploadForecast.do','optionsPopup','channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=yes,scrollbars=no,width=500,height=300,left=250,top=40,resizable=no');
  	    newWindow.focus();
    }

</SCRIPT>

<!-- Top Header Start-->

<%@ include file="/jsp/includes/header.jsp" %>

<!-- Top Header End-->

<%

    // Get Month Names

    int startMonth = -1;
    int monthCount = 0;
    int startYear = -1;

    try
    {
        startMonth = Integer.parseInt( ( String ) request.getAttribute( "startMonth" ) );
        monthCount = Integer.parseInt( ( String ) request.getAttribute( "monthCount" ) );
        //added by varma (13 jul 2004)
        startYear =  Integer.parseInt( ( String ) request.getAttribute( "year" ) );
    }
    catch( NumberFormatException nfe )
    {
        nfe.printStackTrace();
    }

    String[] monthNames = new String[monthCount];
    for( int i=0; i<monthCount; i++ )
    {
        monthNames[i] = MarketingDAO.getMonthName( (startMonth + i)%12 );
    }

    int[] totalForecastAndBackLogByReqDateQty = new int[monthCount];
    float[] totalForecastAndBackLogByReqDateRevenue = new float[monthCount];

    int[] totalForecastAndBackLogBySchDateQty = new int[monthCount];
    float[] totalForecastAndBackLogBySchDateRevenue = new float[monthCount];

    int[] shippedOrderQty = new int[monthCount];
    float[] shippedOrderRevenue = new float[monthCount];

    double[] forecastRevenueByMonth = new double[monthCount];

    String bgcolor[] = { " #DEE1E2", "#FFF1FF" };
    int bgcolorIndex = 0;

%>


<%-- Added by Gandhi on 23 July 2004 to display Marketing Part Number as Product Label --%>
<%
    LabelValueBean lvBean = null;
    String mktgNo = "";
    String mfgNo = (String)request.getAttribute("mfgNo");
    ArrayList list = (ArrayList)request.getAttribute("productList");
    for(int i=0;i<list.size();i++){
        lvBean = (LabelValueBean)list.get(i);
        if(mfgNo != null){
            if(lvBean.getValue().equals(mfgNo)){
                mktgNo = lvBean.getLabel();
            }
        }
    }
%>
<%-- Ends here - Gandhi --%>

<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
  <TBODY>
  <TR>
    <TD width='180' valign='top' background='<%=chipTracContext%>/jsp/includes/images/left_red_bg.gif'>

<!-- Side Navigation start -->

    <%@ include file="/jsp/marketing/marketing_menu.jsp" %>

    </TD>
<!-- end of the side navigations -->
<TD bgcolor="#ffffff">
<IMG height=9 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=8></TD>
<TD bgcolor="#ffffff"><IMG height=480 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=2></TD>
<TD valign="top" width="100%">

<IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/clear.gif" width=500 border=0>
<BR>

<!-- from here your body starts -->
<html:form name="settingForecastForm" method="post" action="/settingForecast" type="com.scalar.chiptrack.sales.forms.SettingForecastForm">
<html:hidden name="settingForecastForm" property="showMkgForecast"/>
<table border=0 cellspacing=0 cellpadding=4 width='98%' align=right class="NArialL">

    <logic:equal name="settingForecastForm" property="showMkgForecast" value="on">
         <tr><td colspan=5 class="NArialW" align='center'> Marketing Forecast </TD></TR>
    </logic:equal>
    <logic:notEqual name="settingForecastForm" property="showMkgForecast" value="on">
        <tr><td colspan=5 class="NArialW" align='center'> Sales Forecast </TD></TR>
    </logic:notEqual>
    <tr><td colspan=5><BR></td></tr>
    <tr><td colspan=5><chiptrack:info styleClass="NArialL"/></td></tr>
    <tr><td colspan=5><chiptrack:errors styleClass="NArialL"/><FONT id='font1' color='#FF0000'></td></tr>
    <logic:equal name="showMessage" value="TRUE">
            <tr><td colspan=7 align='left'>
            <font class='NArialS'>
            <font color='blue'><b><%=Constants.NO_MODIFY_RIGHTS %></b>
            </font></td></tr>
    </logic:equal>

    <tr><td colspan=5><BR></td></tr>
    <tr>
        <td width="15%"> Customer: </td>
        <td width="20%">
           <%-- Modified by veeru on 22nd July 2004--%>
            <%--<html:select name="settingForecastForm" property="customer" styleClass="txfield">
                <option value="-1">-- Select Customer --</option>
                <option value="-1"></option>
                <html:option value="0">-- Others --</html:option>
                <html:options collection="customerList" property="value" labelProperty="label"/>
            </html:select>--%>
            <!-- Modified by varma 26 jul 2004 -->
            <logic:equal name="settingForecastForm" property="customer" value="-1">
            All Customers
            </logic:equal>
            <logic:equal name="settingForecastForm" property="customer" value="0">
            Others
            </logic:equal>
            <logic:notEqual  name="settingForecastForm" property="customer" value="0">
                <logic:notEqual  name="settingForecastForm" property="customer" value="-1">
                     <bean:write name="settingForecastForm" property="customer"/>
                </logic:notEqual>
            </logic:notEqual>
        </td>
        <td width="5%">&nbsp;</td>
        <td width="15%"> Product: </td>
        <td >
           <%-- <html:select name="settingForecastForm" property="product" styleClass="txfield" >
                <option value="-1">-- Select Product --</option>
                <option value="-1"></option>
                <html:options collection="productList" property="value" labelProperty="label"/>
            </html:select>--%>
           <%-- <bean:write name="settingForecastForm" property="product"/>   Commented by Gandhi on 23 July 2004 --%>
            <%= mktgNo %> <%-- Added By Gandhi on 23 July 2004  --%>
        </td>
    </tr>

    <tr>
        <td width="15%"> Start Month: </td>
        <td width="20%">
           <%-- <html:select name="settingForecastForm" property="startMonth" styleClass="txfield">
                <option value="-1">-- Select Month--</option>
                <option value="-1"></option>
                <html:options collection="monthList" property="value" labelProperty="label"/>
            </html:select>  --%>
            <%=MarketingDAO.getMonthName(startMonth)%>
        </td>

        <td width="5%">&nbsp;</td>

        <td width="15%"> Year: </td>
        <td >

            <%--<html:select name="settingForecastForm" property="year" styleClass="txfield">
            <html:option value="-1">-Select-</html:option>
            <html:options collection="years" property="value" labelProperty="label" />
        </html:select> --%>
        <bean:write name="settingForecastForm" property="year"/>
        </td>
    </tr>

    <tr>
        <td width="15%"> Showing next: </td>
        <td width="20%">
            <%-- <html:text name="settingForecastForm" property="monthCount" maxlength="2" size="2" styleClass="txfield" onkeypress="javascript:restrictCharactersAndDot()" /> --%>
            <bean:write name="settingForecastForm" property="monthCount"/>
            months
        </td>
         <logic:equal name="settingForecastForm" property="showMkgForecast" value="on">
        <td width="5%">&nbsp;</td>
        <td colspan=2>
            <!-- html:checkbox name="settingForecastForm" property="showMkgForecast"/> Show Marketing Forecast -->
        </td>
        </logic:equal>
        <logic:notEqual name="settingForecastForm" property="showMkgForecast" value="on">
        <logic:notEqual name="settingForecastForm" property="endUser" value="">
        <td width="5%">&nbsp;</td>
        <td width="15%"><font class="NArialL"><bean:message key="label.sales.endCustomer"/></font></td>
        <td >
           <bean:write name="settingForecastForm" property="endUser"/>
        </td>
       </logic:notEqual>
       </logic:notEqual>
    </tr>
    <%--
    <tr><td colspan=5 align="center">
        <logic:notEmpty name="settingForecastForm" property="showMkgForecast">
            <A href="javascript:loadMarketingForecast();"><IMG src="<%=chipTracContext%>/jsp/includes/images/search.gif" border='0'onmouseover="window.status='Click to Search Marketing Forecast';return true" onmouseout="window.status='';return true"title="Click here to Search Marketing Forecast"></A>
        </logic:notEmpty>
        <logic:empty name="settingForecastForm" property="showMkgForecast">
            <A href="javascript:loadSalesForecast();"><IMG src="<%=chipTracContext%>/jsp/includes/images/search.gif" border='0' onmouseover="window.status='Click to Search Sales Forecast Form';return true" onmouseout="window.status='';return true"title="Click here to Search Sales Forecast"></A>
        </logic:empty>

        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <A href="javascript:document.settingForecastForm.reset();"><IMG src="<%=chipTracContext%>/jsp/includes/images/reset.gif" border='0' onmouseover="window.status='Click to Reset';return true" onmouseout="window.status='';return true"title="Click here to Reset"></A>
    </td></tr>
    --%>
    <tr><td colspan=5><br><br></td></tr>

    <tr><td colspan=4 valign="top">
            <logic:notEmpty name="settingForecastForm" property="showMkgForecast">
                <html:checkbox name="settingForecastForm"  property="showIndForecast" onclick="javascript:loadMarketingForecast();"/>
            </logic:notEmpty>
            <logic:empty name="settingForecastForm" property="showMkgForecast">
                <html:checkbox name="settingForecastForm"  property="showIndForecast" onclick="javascript:loadSalesForecast();"/>
            </logic:empty>

            <font class=NArialS>Show individual Forecast Details</font><br>
            <logic:notEmpty name="settingForecastForm" property="showMkgForecast">
                <html:checkbox name="settingForecastForm"  property="showHoldBacklogByReq" onclick="javascript:loadMarketingForecast();"/>
            </logic:notEmpty>
            <logic:empty name="settingForecastForm" property="showMkgForecast">
                <html:checkbox name="settingForecastForm"  property="showHoldBacklogByReq" onclick="javascript:loadSalesForecast();"/>
            </logic:empty>

            <font class=NArialS>Show Hold Backlog by Requested Date</font><br>
            <logic:notEmpty name="settingForecastForm" property="showMkgForecast">
                <html:checkbox name="settingForecastForm"  property="showHoldBacklogBySch" onclick="javascript:loadMarketingForecast();"/>
            </logic:notEmpty>
            <logic:empty name="settingForecastForm" property="showMkgForecast">
                <html:checkbox name="settingForecastForm"  property="showHoldBacklogBySch" onclick="javascript:loadSalesForecast();"/>
            </logic:empty>
            <font class=NArialS>Show Hold Backlog by Schedule Date</font><br></td>
     <td colspan=1 valign="top" align="center">
           <!-- Commented by varma 26 jul 2004 ,it is diaplaying in search page -->
          <%--  <logic:equal name="settingForecastForm" property="showMkgForecast" value="on">
                  <font class=NArialS><a href="javascript:openWindow();" onMouseOver="window.status='Click here to upload file';return true" onmouseout="window.status='';return true">Click here to upload file</a></font>
            </logic:equal>   --%>
     </td></tr>

     <tr><td colspan=5><br>

            <table border=1 bordercolor=#DEE1E2 cellspacing=2 cellpadding=0 width='100%' class="NArialS">
                <TR height="20" class="NArialL">
                    <!-- PRINT MONTH HERADER -->
                    <TD width="20%" align="center" bgcolor="#993333" ><font color="#FFFFFF">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></TD>
                    <%
                        if( ( monthNames != null ) && ( monthNames.length > 0 ) )
                        {    int year = startYear;
                            for( int i=0; i<monthNames.length; i++ )
                            {

                    %>
                     <logic:empty name="settingForecastForm" property="showMkgForecast">
                        <TD colspan=3 align="center" bgcolor="#993333"><font color="#FFFFFF"><%=monthNames[i]%>-<%=year%></font> </TD>
                     </logic:empty>
                     <logic:notEmpty name="settingForecastForm" property="showMkgForecast">
                        <TD colspan=2 align="center" bgcolor="#993333"><font color="#FFFFFF"><%=monthNames[i]%>-<%=year%></font> </TD>
                     </logic:notEmpty>
                     <%    //added by varma 15 jul 2004
                            if( monthNames[i].equals("Dec") ){
                                        year++;
                              }//if
                            }   // for
                        }//if
                     %>
                    <TD width="5%" align="center" bgcolor="#993333" wordwrap><font color="#FFFFFF">&nbsp;</TD>
                </TR>

                <TR  class="NArialL">
                    <!-- PRINT QTY/PRICE HERADER -->
                    <TD width="10%" align="center" bgcolor="#AAAAFF">&nbsp;</TD>
                    <%
                        if( ( monthNames != null ) && ( monthNames.length > 0 ) )
                        {
                            for( int i=0; i<monthNames.length; i++ )
                            {
                    %>
                     <TD align="center" bgcolor="#AAAAFF"><font color="#000000">Qty</font></TD>
                     <TD align="center" bgcolor="#AAAAFF"><font color="#000000">Unit Price<br>($)</font></TD>

                     <logic:empty name="settingForecastForm" property="showMkgForecast">
                        <TD align="center" bgcolor="#AAAAFF"><font color="#000000">Confidence level<br>(%)</font></TD>
                     </logic:empty>


                     <%
                            }   // for
                        }//if
                     %>

                     <TD width="7%" align="center" bgcolor="#AAAAFF">Projected<br>Revenue</TD>

                </TR>

                <TR height=30 bgcolor=<%=bgcolor[(bgcolorIndex++)%2]%> class="NArialS">
                    <!-- PRINT TEXT FIELDS -->
                    <TD width="10%" wordwrap>
                        <font class=NArialS>

                        <logic:notEmpty name="settingForecastForm" property="showMkgForecast">&nbsp;Marketing<br></logic:notEmpty>
                        <logic:empty name="settingForecastForm" property="showMkgForecast">&nbsp;Sales<br></logic:empty>
                        &nbsp;Forecast&nbsp

                        </font></font>
                    </TD>

                    <%
                        double projectedRevenue = 0;
                        float revenue = 0.0f;
                        if( ( monthNames != null ) && ( monthNames.length > 0 ) )
                        {
                            HashMap forecastDetails = ( HashMap ) request.getAttribute( "forecastDetails" );
                            if( forecastDetails != null )
                            {
                                MarketingForecast marketingForecast = null;
                                int qty = 0;
                                double unitPrice = 0.0f;
                                float confidenceLevel = 100.0f;
                                String strQty = "&nbsp;";
                                String strUnitPrice = "&nbsp;";
                                String strConfidenceLevel = "&nbsp;";
                                int forecastMonth = -1;

                                Calendar rightNow = Calendar.getInstance();
                                int currentMonth = rightNow.get( Calendar.MONTH );
                                int currentYear =  rightNow.get( Calendar.YEAR );
                                for( int i=0; i < monthNames.length; i++ )
                                {
                                    marketingForecast = ( MarketingForecast ) forecastDetails.get( ( startMonth + i ) + "" );
                                    if( marketingForecast != null )
                                    {
                                        qty = marketingForecast.getForecastQty();
                                        unitPrice = marketingForecast.getUnitPrice();
                                        confidenceLevel = marketingForecast.getConfidenceLevel();

                                        strQty = StringUtils.formatUnits( qty );
                                        strUnitPrice = StringUtils.formatAmount( unitPrice );
                                        strConfidenceLevel = StringUtils.formatAmount( confidenceLevel );


                                        //totalForecastAndBackLogByReqDateQty[i] += qty;
                                        //totalForecastAndBackLogByReqDateRevenue[i] += unitPrice;
                                        forecastRevenueByMonth[i] = (qty*unitPrice);

                                        //projectedRevenue += qty;
                                        projectedRevenue += forecastRevenueByMonth[i];
                                    }
                                    else
                                    {
                                        strQty = "";
                                        strUnitPrice = "";
                                        strConfidenceLevel ="";
                                        qty = 0;
                                        unitPrice = 0.0;
                                        confidenceLevel = 100.0f;
                                    }
                                    forecastMonth = MarketingDAO.getMonth (monthNames[i]);
                                    //modified by varma (13 jul 2004)
                                    if( (startYear < currentYear) || ( startYear == currentYear &&  forecastMonth < currentMonth ) )
                                    {

                    %>
                                     <TD align="center" nowrap>
                                        <input type=text name="qty" size=6 maxlength=5 value="<%=qty%>" class="txfield" disabled="true">
                                     </TD>

                                     <TD align="center" nowrap>
                                            <input type=text name="unitPrice" size=6 maxlength=5 value="<%=unitPrice%>" class="txfield" disabled="true">
                                     </TD>

                                     <logic:empty name="settingForecastForm" property="showMkgForecast">
                                        <TD align="center" nowrap>
                                            <input type=text name="confidenceLevel" size=6 maxlength=5 value="<%=confidenceLevel%>" class="txfield" disabled="true">
                                        </TD>
                                     </logic:empty>


                   <%                }
                                    else
                                    {
                   %>
                                     <TD align="center" nowrap>
                                        <input type=text name="qty" size=6 maxlength=5 value="<%=qty%>" class="txfield" onKeyPress="javascript:restrictCharactersAndDot()">
                                     </TD>

                                     <TD align="center" nowrap>
                                            <input type=text name="unitPrice" size=6 value="<%=unitPrice%>" class="txfield" onkeypress="javascript:restrictCharacters(this,5,2)" maxlength="7" onkeyup="javascript:restrictAmt(this,5,2)">
                                     </TD>
                                     <logic:empty name="settingForecastForm" property="showMkgForecast">
                                        <TD align="center" nowrap>
                                            <input type=text name="confidenceLevel" size=6 maxlength=5 value="<%=confidenceLevel%>" class="txfield" onkeypress="javascript:restrictCharacters(this,3,2)" maxlength="6" onkeyup="javascript:restrictAmt(this,3,2)" >
                                        </TD>
                                     </logic:empty>


                     <%
                                    }
                                     if( monthNames[i].equals("Dec") ){
                                        startYear++;
                                    }

                                }   // for loop
                            }       // if forecastDetails is not null
                        }           // if monthNames is not null
                     %>

                    <TD width="7%" align="right" ><%=StringUtils.formatAmount( projectedRevenue,"$###,###.##")%>&nbsp;</TD>

                </TR>


                <!-- Show Individual Forecast details Start -->
                <logic:notEmpty name="settingForecastForm" property="showIndForecast">

                <%
                projectedRevenue = 0.0f;
                if( ( monthNames != null ) && ( monthNames.length > 0 ) )
                {
                    MarketingForecast marketingForecast = null;
                    int qty = 0;
                    double unitPrice = 0.0f;
                    float  confidenceLevel = 0.0f;
                    String strQty = "&nbsp;";
                    String strUnitPrice = "&nbsp;";
                    String strConfidenceLevel = "&nbsp;";
                    String createdBy = null;
                    LinkedHashMap forecastDetails = null;   // Modified by Gandhi on 5th Aug 2004.HashMap replaced with LinkedHashMap

                    LinkedHashMap completeForecastDetails = ( LinkedHashMap ) request.getAttribute( "completeForecastDetails" );
                    if( completeForecastDetails != null )
                    {
                        Iterator userNameIterator = completeForecastDetails.keySet().iterator();

                        while( userNameIterator.hasNext() == true )
                        {
                            projectedRevenue = 0.0f;

                            createdBy = ( String ) userNameIterator.next();

                            forecastDetails = ( LinkedHashMap ) completeForecastDetails.get( createdBy );

                            if( ( forecastDetails != null ) && ( forecastDetails.isEmpty() == false ) )
                            {
                %>

                <TR height=30 bgcolor=<%=bgcolor[(bgcolorIndex++)%2]%>>
                    <!-- PRINT TEXT FIELDS -->
                    <TD width="10%" >
                        <font class=NArialS>
                        &nbsp;Forecast By<br>&nbsp;<%=createdBy%>
                        </font></font>
                    </TD>

                    <%

                        for( int i=0; i < monthNames.length; i++ )
                        {

                            marketingForecast = ( MarketingForecast ) forecastDetails.get( ( startMonth + i ) + "" );
                            if( marketingForecast != null )
                            {
                                qty = marketingForecast.getForecastQty();
                                unitPrice = marketingForecast.getUnitPrice();
                                confidenceLevel = marketingForecast.getConfidenceLevel();

                                strQty = StringUtils.formatUnits( qty );
                                strUnitPrice = "$ " + StringUtils.formatAmount( unitPrice );
                                strConfidenceLevel = StringUtils.formatAmount( confidenceLevel );


                                //totalForecastAndBackLogByReqDateQty[i] += qty;
                                //totalForecastAndBackLogByReqDateRevenue[i] += unitPrice;
                                //projectedRevenue += qty;
                                projectedRevenue += (qty*unitPrice);
                            }
                            else
                            {
                                strQty = "&nbsp;";
                                strUnitPrice = "&nbsp;";
                                strConfidenceLevel = "&nbsp;";
                                // Added by Prabhanjan (14 Jul 2004)
                                qty = 0;
                                unitPrice = 0.0;
                                confidenceLevel = 100.0f;
                            }
                    %>
                             <TD align="right" nowrap><%=strQty%>&nbsp;</TD>
                             <TD align="right" nowrap><%=strUnitPrice%>&nbsp;</TD>
                             <logic:empty name="settingForecastForm" property="showMkgForecast">
                                <TD align="right" nowrap><%=strConfidenceLevel%>&nbsp;</TD>
                             </logic:empty>


                     <%
                        }   // for loop
                     %>

                    <%--<TD width="7%" align="right" ><%="$ " + StringUtils.formatAmount( projectedRevenue )%>&nbsp;</TD>--%>
                    <TD width="7%" align="right" ><%=StringUtils.formatAmount( projectedRevenue,"$###,###.##")%>&nbsp;</TD>


                </TR>

                <%
                                }   // if forecast details are not null
                            }       // while more userNames
                        }           // if completeForecastDetails HashMap is not null
                    }               // if the months are defined
                %>

                </logic:notEmpty>

                <!-- Show Individual Forecast details End -->




                <!-- Show Forecast totals Start -->
                <logic:notEmpty name="settingForecastForm" property="showMkgForecast">

                <TR height=30 bgcolor=<%=bgcolor[(bgcolorIndex++)%2]%>>
                    <!-- PRINT TEXT FIELDS -->
                    <TD width="10%" >
                        <font class=NArialS>
                        &nbsp;Individiual<br>&nbsp;Forecast Totals
                        </font></font>
                    </TD>

                    <%
                        projectedRevenue = 0.0f;
                        if( ( monthNames != null ) && ( monthNames.length > 0 ) )
                        {
                            HashMap forecastDetailTotals = ( HashMap ) request.getAttribute( "forecastDetailTotals" );
                            if( forecastDetailTotals != null )
                            {
                                MarketingForecast marketingForecast = null;
                                int qty = 0;
                                double unitPrice = 0.0f;
                                String strQty = "&nbsp;";
                                String strUnitPrice = "&nbsp;";

                                for( int i=0; i < monthNames.length; i++ )
                                {
                                    marketingForecast = ( MarketingForecast ) forecastDetailTotals.get( ( startMonth + i ) + "" );
                                    if( marketingForecast != null )
                                    {
                                        qty = marketingForecast.getForecastQty();
                                        unitPrice = marketingForecast.getUnitPrice();

                                        strQty = StringUtils.formatUnits( qty );
                                        strUnitPrice = "$ " + StringUtils.formatAmount( unitPrice );

                                        //projectedRevenue += qty;
                                        projectedRevenue += (qty*unitPrice);
                                        //totalForecastAndBackLogByReqDateQty[i] += qty;
                                        //totalForecastAndBackLogByReqDateRevenue[i] += unitPrice;
                                    }
                                    else
                                    {
                                        strQty = "&nbsp;";
                                        strUnitPrice = "&nbsp;";
                                        // Added by Prabhanjan (14 Jul 2004)
                                        qty = 0;
                                        unitPrice = 0.0;
                                    }
                    %>
                                     <TD align="right" nowrap><%=strQty%>&nbsp;</TD>
                                     <TD align="right" nowrap><%=strUnitPrice%>&nbsp;</TD>

                     <%
                                }   // for loop
                            }       // if forecastDetails is not null
                        }           // if monthNames is not null
                     %>

                    <TD width="7%" align="right" ><%=StringUtils.formatAmount( projectedRevenue,"$###,###.##")%>&nbsp;</TD>

                </TR>
                </logic:notEmpty>
                <!-- Show forecast totals END -->

                <!-- Show Forecast Projected Revenu by month -- Start -->

                <TR height=30 bgcolor=<%=bgcolor[(bgcolorIndex++)%2]%> class="NArialS">

                    <!-- PRINT TEXT FIELDS -->
                    <TD width="10%" ><font class=NArialS>&nbsp;Forecast Revenue<br>&nbsp;By Month</font></TD>
                    <%
                        revenue = 0.0f;
                        if( ( monthNames != null ) && ( monthNames.length > 0 ) )
                        {
                            for( int i=0; i < monthNames.length; i++ )
                            {
                    %>
                                 <TD align="right" nowrap>&nbsp;</TD>
                                 <TD align="right" nowrap><%="$ " + StringUtils.formatAmount( forecastRevenueByMonth[i] )%>&nbsp;</TD>
                                 <logic:empty name="settingForecastForm" property="showMkgForecast">
                                    <TD align="right" nowrap>&nbsp;</TD>
                                 </logic:empty>


                    <%
                            }   // for loop
                        }           // if monthNames is not null
                     %>

                    <TD width="7%" align="right" >&nbsp;</TD>
                </TR>

                <!-- Show Forecast Projected Revenu by month -- End -->


                <TR height=3 bgcolor="#AAAAFF"><TD colspan=<%=((6*monthCount)+2)%>>&nbsp;</TD></TR>


                <!-- Show Open B/L by Req Date -->

                <TR height=30 bgcolor=<%=bgcolor[(bgcolorIndex++)%2]%> class="NArialS">
                    <!-- PRINT TEXT FIELDS -->
                    <TD width="10%" ><font class=NArialS>&nbsp;Open B/L By<br>&nbsp;Req. Date &nbsp</font></TD>
                    <%
                        projectedRevenue = 0.0f;
                        if( ( monthNames != null ) && ( monthNames.length > 0 ) )
                        {
                            HashMap openBacklogByReqDate = ( HashMap ) request.getAttribute( "openBacklogByReqDate" );
                            if( openBacklogByReqDate != null )
                            {
                                MarketingForecast marketingForecast = null;
                                String strQty = "&nbsp;";
                                String strUnitPrice = "&nbsp;";
                                int qty = 0;
                                double unitPrice = 0.0f;

                                for( int i=0; i < monthNames.length; i++ )
                                {
                                    marketingForecast = ( MarketingForecast ) openBacklogByReqDate.get( ( startMonth + i ) + "" );

                                    if( marketingForecast != null )
                                    {
                                        qty = marketingForecast.getForecastQty();
                                        unitPrice = marketingForecast.getUnitPrice();


                                        strQty = StringUtils.formatUnits( qty );
                                        strUnitPrice = "$ " + StringUtils.formatAmount( unitPrice );


                                        //projectedRevenue += qty;
                                        projectedRevenue += (qty*unitPrice);
                                        totalForecastAndBackLogByReqDateQty[i] += qty;
                                      // Modified by Gandhi on 2 Aug 2004
                                       //totalForecastAndBackLogByReqDateRevenue[i] += (qty*unitPrice);
                                         totalForecastAndBackLogByReqDateRevenue[i] += (float)unitPrice;
                                      // Modification ends here - Gandhi
                                    }
                                    else
                                    {
                                        strQty = "&nbsp;";
                                        strUnitPrice = "&nbsp;";

                                        // Added by Prabhanjan (14 Jul 2004)
                                        qty = 0;
                                        unitPrice = 0.0;
                                    }
                    %>
                                     <TD align="right" nowrap><%=strQty%>&nbsp;</TD>
                                     <TD align="right" nowrap><%=strUnitPrice%>&nbsp;</TD>
                                     <logic:empty name="settingForecastForm" property="showMkgForecast">
                                        <TD align="right" nowrap>&nbsp;</TD>
                                     </logic:empty>


                     <%
                                }   // for loop
                            }       // if openBacklogByReqDate is not null
                        }           // if monthNames is not null
                     %>

                <%--    <TD width="7%" align="right" ><%=StringUtils.formatAmount( projectedRevenue,"$###,###.##")%>&nbsp;</TD> --%>
                <TD width="7%" align="right" >&nbsp;</TD>
                </TR>

                <!-- Show Open B/L by Req Date -- END -->

                <!-- Show Hold B/L by Req Date -->
                <logic:notEmpty name="settingForecastForm" property="showHoldBacklogByReq">
                <TR height=30 bgcolor=<%=bgcolor[(bgcolorIndex++)%2]%> class="NArialS">
                    <!-- PRINT TEXT FIELDS -->
                    <TD width="10%" ><font class=NArialS>&nbsp;Hold B/L By<br>&nbsp;Req. Date &nbsp</font></TD>
                    <%
                        projectedRevenue = 0.0f;
                        if( ( monthNames != null ) && ( monthNames.length > 0 ) )
                        {
                            HashMap holdBacklogByReqDate = ( HashMap ) request.getAttribute( "holdBacklogByReqDate" );
                            if( holdBacklogByReqDate != null )
                            {
                                MarketingForecast marketingForecast = null;
                                String strQty = "&nbsp;";
                                String strUnitPrice = "&nbsp;";

                                int qty = 0;
                                double unitPrice = 0.0f;


                                for( int i=0; i < monthNames.length; i++ )
                                {
                                    marketingForecast = ( MarketingForecast ) holdBacklogByReqDate.get( ( startMonth + i ) + "" );
                                    if( marketingForecast != null )
                                    {
                                        qty = marketingForecast.getForecastQty();
                                        unitPrice = marketingForecast.getUnitPrice();

                                        strQty = StringUtils.formatUnits( qty );
                                        strUnitPrice = "$ " + StringUtils.formatAmount( unitPrice );


                                        //projectedRevenue += qty;
                                        projectedRevenue += (qty*unitPrice);
                                        totalForecastAndBackLogByReqDateQty[i] += qty;
                                        // Modified by Gandhi on 2 Aug 2004
                                        //  totalForecastAndBackLogByReqDateRevenue[i] += (qty*unitPrice);
                                        totalForecastAndBackLogByReqDateRevenue[i] += (float)unitPrice;
                                        // Modification ends here - Gandhi
                                    }
                                    else
                                    {
                                        strQty = "&nbsp;";
                                        strUnitPrice = "&nbsp;";

                                        // Added by Prabhanjan (14 Jul 2004)
                                        qty = 0;
                                        unitPrice = 0.0;
                                    }
                    %>
                                     <TD align="right" nowrap><%=strQty%>&nbsp;</TD>
                                     <TD align="right" nowrap><%=strUnitPrice%>&nbsp;</TD>
                                     <logic:empty name="settingForecastForm" property="showMkgForecast">
                                        <TD align="right" nowrap>&nbsp;</TD>
                                     </logic:empty>


                     <%
                                }   // for loop
                            }       // if openBacklogByReqDate is not null
                        }           // if monthNames is not null
                     %>

                  <%--  <TD width="7%" align="right"><%=StringUtils.formatAmount( projectedRevenue,"$###,###.##")%>&nbsp;</TD> --%>
                  <TD width="7%" align="right" >&nbsp;</TD>
                </TR>
                </logic:notEmpty>

                <!-- Show Hold B/L by Req Date -- END -->

                <!-- Show Open B/L by Sch Date -->

                <TR height=30 bgcolor=<%=bgcolor[(bgcolorIndex++)%2]%> class="NArialS">
                    <!-- PRINT TEXT FIELDS -->
                    <TD width="10%" ><font class=NArialS>&nbsp;Open B/L By<br>&nbsp;Sch. Date </font></TD>
                    <%
                        projectedRevenue = 0.0f;
                        revenue = 0.0f;
                        if( ( monthNames != null ) && ( monthNames.length > 0 ) )
                        {
                            HashMap openBacklogBySchDate = ( HashMap ) request.getAttribute( "openBacklogBySchDate" );
                            if( openBacklogBySchDate != null )
                            {
                                MarketingForecast marketingForecast = null;
                                String strQty = "&nbsp;";
                                String strUnitPrice = "&nbsp;";

                                int qty = 0;
                                double unitPrice = 0.0f;


                                for( int i=0; i < monthNames.length; i++ )
                                {
                                    marketingForecast = ( MarketingForecast ) openBacklogBySchDate.get( ( startMonth + i ) + "" );
                                    if( marketingForecast != null )
                                    {
                                        qty = marketingForecast.getForecastQty();
                                        unitPrice = marketingForecast.getUnitPrice();

                                        strQty = StringUtils.formatUnits( qty );
                                        strUnitPrice = "$ " + StringUtils.formatAmount( unitPrice );


                                        //projectedRevenue += qty;
                                        projectedRevenue += (qty*unitPrice);
                                        totalForecastAndBackLogBySchDateQty[i] += qty;
                                        // Modified by Gandhi on 2 Aug 2004
                                       // totalForecastAndBackLogBySchDateRevenue[i] += (qty*unitPrice);
                                        totalForecastAndBackLogBySchDateRevenue[i] += (float)unitPrice;
                                        // Modification ends here - Gandhi
                                    }
                                    else
                                    {
                                        strQty = "&nbsp;";
                                        strUnitPrice = "&nbsp;";

                                        // Added by Prabhanjan (14 Jul 2004)
                                        qty = 0;
                                        unitPrice = 0.0;
                                    }
                    %>
                                     <TD align="right" nowrap><%=strQty%>&nbsp;</TD>
                                     <TD align="right" nowrap><%=strUnitPrice%>&nbsp;</TD>
                                     <logic:empty name="settingForecastForm" property="showMkgForecast">
                                        <TD align="right" nowrap>&nbsp;</TD>
                                     </logic:empty>

                     <%
                                }   // for loop
                            }       // if openBacklogByReqDate is not null
                        }           // if monthNames is not null
                     %>

                  <%--  <TD width="7%" align="right" ><%=StringUtils.formatAmount( projectedRevenue,"$###,###.##")%>&nbsp;</TD> --%>
                  <TD width="7%" align="right" >&nbsp;</TD>
                </TR>

                <!-- Show Open B/L by Sch Date -- END -->


                <!-- Show Hold B/L by Sch Date -->
                <logic:notEmpty name="settingForecastForm" property="showHoldBacklogBySch">

                <TR height=30 bgcolor=<%=bgcolor[(bgcolorIndex++)%2]%> class="NArialS">
                    <!-- PRINT TEXT FIELDS -->
                    <TD width="10%" ><font class=NArialS>&nbsp;Hold B/L By<br>&nbsp;Sch. Date </font></TD>
                    <%
                        projectedRevenue = 0.0f;
                        revenue = 0.0f;
                        if( ( monthNames != null ) && ( monthNames.length > 0 ) )
                        {
                            HashMap holdBacklogBySchDate = ( HashMap ) request.getAttribute( "holdBacklogBySchDate" );
                            if( holdBacklogBySchDate != null )
                            {
                                MarketingForecast marketingForecast = null;
                                String strQty = "&nbsp;";
                                String strUnitPrice = "&nbsp;";

                                int qty = 0;
                                double unitPrice = 0.0f;


                                for( int i=0; i < monthNames.length; i++ )
                                {
                                    marketingForecast = ( MarketingForecast ) holdBacklogBySchDate.get( ( startMonth + i ) + "" );
                                    if( marketingForecast != null )
                                    {
                                        qty = marketingForecast.getForecastQty();
                                        unitPrice = marketingForecast.getUnitPrice();

                                        strQty = StringUtils.formatUnits( qty );
                                        strUnitPrice = "$ " + StringUtils.formatAmount( unitPrice );


                                        //projectedRevenue += qty;
                                        projectedRevenue += (qty*unitPrice);
                                        totalForecastAndBackLogBySchDateQty[i] += qty;
                                        // Modified by Gandhi on 2 Aug 2004
                                       // totalForecastAndBackLogBySchDateRevenue[i] += (qty*unitPrice);
                                        totalForecastAndBackLogBySchDateRevenue[i] += (float)unitPrice;
                                        // Modification ends here - Gandhi
                                    }
                                    else
                                    {
                                        strQty = "&nbsp;";
                                        strUnitPrice = "&nbsp;";

                                        // Added by Prabhanjan (14 Jul 2004)
                                        qty = 0;
                                        unitPrice = 0.0;
                                    }
                    %>
                                     <TD align="right" nowrap><%=strQty%>&nbsp;</TD>
                                     <TD align="right" nowrap><%=strUnitPrice%>&nbsp;</TD>
                                     <logic:empty name="settingForecastForm" property="showMkgForecast">
                                        <TD align="right" nowrap>&nbsp;</TD>
                                     </logic:empty>

                     <%
                                }   // for loop
                            }       // if openBacklogByReqDate is not null
                        }           // if monthNames is not null
                     %>

                <%--  <TD width="7%" align="right" ><%=StringUtils.formatAmount( projectedRevenue,"$###,###.##")%>&nbsp;</TD>  --%>
                <TD width="7%" align="right" >&nbsp;</TD>
                </TR>
                </logic:notEmpty>

                <!-- Show Hold B/L by Sch Date -- END -->

                <!-- Show Shipped Qty Start -->
                <TR height=30 bgcolor=<%=bgcolor[(bgcolorIndex++)%2]%> class="NArialS">
                    <!-- PRINT TEXT FIELDS -->
                    <TD width="10%" ><font class=NArialS>&nbsp;Shipped Qty</font></TD>
                    <%
                        projectedRevenue = 0.0f;
                        revenue = 0.0f;
                        if( ( monthNames != null ) && ( monthNames.length > 0 ) )
                        {
                            HashMap shippedOrders = ( HashMap ) request.getAttribute( "shippedOrders" );
                            if( shippedOrders != null )
                            {
                                MarketingForecast marketingForecast = null;
                                String strQty = "&nbsp;";
                                String strUnitPrice = "&nbsp;";

                                int qty = 0;
                                double unitPrice = 0.0f;


                                for( int i=0; i < monthNames.length; i++ )
                                {
                                    marketingForecast = ( MarketingForecast ) shippedOrders.get( ( startMonth + i ) + "" );

                                    if( marketingForecast != null )
                                    {
                                        qty = marketingForecast.getForecastQty();
                                        unitPrice = marketingForecast.getUnitPrice();


                                        strQty = StringUtils.formatUnits( qty );
                                        strUnitPrice = "$ " + StringUtils.formatAmount( unitPrice );


                                        //projectedRevenue += qty;
                                        projectedRevenue += (qty*unitPrice);
                                        shippedOrderQty[i] += qty;
                                        // Modified by Gandhi on 2 Aug 2004
                                       // shippedOrderRevenue[i] += (qty*unitPrice);
                                        shippedOrderRevenue[i] += (float)unitPrice;
                                        // Modification ends here - Gandhi
                                    }
                                    else
                                    {
                                        strQty = "&nbsp;";
                                        strUnitPrice = "&nbsp;";

                                        // Added by Prabhanjan (14 Jul 2004)
                                        qty = 0;
                                        unitPrice = 0.0;
                                    }
                    %>
                                     <TD align="right" nowrap><%=strQty%>&nbsp;</TD>
                                     <TD align="right" nowrap><%=strUnitPrice%>&nbsp;</TD>
                                     <logic:empty name="settingForecastForm" property="showMkgForecast">
                                        <TD align="right" nowrap>&nbsp;</TD>
                                     </logic:empty>

                     <%
                                }   // for loop
                            }       // if openBacklogByReqDate is not null
                        }           // if monthNames is not null
                     %>

                 <%--  <TD width="7%" align="right" ><%=StringUtils.formatAmount( projectedRevenue,"$###,###.##")%>&nbsp;</TD>  --%>
                 <TD width="7%" align="right" >&nbsp;</TD>
                </TR>
                <!-- Show Shipped Qty Start -- END -->


                <!-- Show Shipped + B/L by ReqDate Totals Start -->

                <TR height=30 bgcolor=<%=bgcolor[(bgcolorIndex++)%2]%> class="NArialS">

                    <!-- PRINT TEXT FIELDS -->
                    <TD width="10%" ><font class=NArialS>&nbsp;Shipped + <br>&nbsp;B/L By Req. Date</font></TD>
                    <%
                        revenue = 0.0f;
                        if( ( monthNames != null ) && ( monthNames.length > 0 ) )
                        {
                            for( int i=0; i < monthNames.length; i++ )
                            {
                    %>
                                 <TD align="right" nowrap><%=StringUtils.formatUnits( totalForecastAndBackLogByReqDateQty[i] + shippedOrderQty[i] )%>&nbsp;</TD>
                                 <TD align="right" nowrap><%="$ " + StringUtils.formatAmount( totalForecastAndBackLogByReqDateRevenue[i]  + shippedOrderRevenue[i] )%>&nbsp;</TD>
                                 <logic:empty name="settingForecastForm" property="showMkgForecast">
                                    <TD align="right" nowrap>&nbsp;</TD>
                                 </logic:empty>



                    <%
                            }   // for loop
                        }           // if monthNames is not null
                     %>

                    <TD width="7%" align="right" >&nbsp;</TD>
                </TR>

                <!-- Show Forecast and B/L by ReqDate Totals End -->



                <!-- Show Shipped + B/L by Schedule Date Totals Start -->

                <TR height=30 bgcolor=<%=bgcolor[(bgcolorIndex++)%2]%> class="NArialS">

                    <!-- PRINT TEXT FIELDS -->
                    <TD width="10%" ><font class=NArialS>&nbsp;Shipped + <br>&nbsp;B/L By Sch. Date</font></TD>
                    <%
                        revenue = 0.0f;
                        if( ( monthNames != null ) && ( monthNames.length > 0 ) )
                        {
                            for( int i=0; i < monthNames.length; i++ )
                            {
                    %>
                                 <TD align="right" nowrap><%=StringUtils.formatUnits( totalForecastAndBackLogBySchDateQty[i]  + shippedOrderQty[i] )%>&nbsp;</TD>
                                 <TD align="right" nowrap><%="$ " + StringUtils.formatAmount( totalForecastAndBackLogBySchDateRevenue[i]  + shippedOrderRevenue[i] )%>&nbsp;</TD>
                                 <logic:empty name="settingForecastForm" property="showMkgForecast">
                                    <TD align="right" nowrap>&nbsp;</TD>
                                 </logic:empty>
                    <%
                            }   // for loop
                        }           // if monthNames is not null
                     %>

                    <TD width="7%" align="right" >&nbsp;</TD>
                </TR>

                <!-- Show Forecast and B/L by ReqDate Totals End -->


            </table>
        </td>
    </tr>

    <tr><td colspan=5><br></td></tr>


    <tr><td colspan=5 align="center">
        <%-- Modified by veeru on 22nd July 2004
        <A href="javascript:submitPage();"><IMG src="<%=chipTracContext%>/jsp/includes/images/save.gif" border='0' onmouseover="window.status='Click to Save Forecast ';return true" onmouseout="window.status='';return true" title="Click here to Save Forecast" ></A> --%>
        <logic:equal name="settingForecastForm" property="showMkgForecast" value="on">
        <chiptrack:restrictedLink functionality='<%=Functionality.SETTING_MARKETING_FORECAST%>' action='<%=User.USER_ACTION_MODIFY%>' href="javascript:submitPage();" onmouseover="window.status='Click to Save Forecast';return true" onmouseout="window.status='';return true">
        <img src="<%=chipTracContext%>/jsp/includes/images/save.gif" border='0' title="Click to Save Forecast"></chiptrack:restrictedLink>
        </logic:equal>
        <logic:notEqual name="settingForecastForm" property="showMkgForecast" value="on">
        <chiptrack:restrictedLink functionality='<%=Functionality.SETTING_SALES_FORECAST%>' action='<%=User.USER_ACTION_MODIFY%>' href="javascript:submitPage();" onmouseover="window.status='Click to Save Forecast';return true" onmouseout="window.status='';return true">
        <img src="<%=chipTracContext%>/jsp/includes/images/save.gif" border='0' title="Click to Save Forecast"></chiptrack:restrictedLink>
        </logic:notEqual>
        <%-- Added by Gandhi on 4th Aug 2004 --%>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <logic:equal name="settingForecastForm" property="showMkgForecast" value="on">
        <chiptrack:restrictedLink functionality='<%=Functionality.SETTING_MARKETING_FORECAST%>' action='<%=User.USER_ACTION_MODIFY%>' href="javascript:document.settingForecastForm.reset();" onmouseover="window.status='Click to Reset';return true" onmouseout="window.status='';return true">
        <img src="<%=chipTracContext%>/jsp/includes/images/reset.gif" border='0' title="Click here to Reset"></chiptrack:restrictedLink>
        </logic:equal>
        <logic:notEqual name="settingForecastForm" property="showMkgForecast" value="on">
        <chiptrack:restrictedLink functionality='<%=Functionality.SETTING_SALES_FORECAST%>' action='<%=User.USER_ACTION_MODIFY%>' href="javascript:document.settingForecastForm.reset();" onmouseover="window.status='Click to Reset';return true" onmouseout="window.status='';return true">
        <img src="<%=chipTracContext%>/jsp/includes/images/reset.gif" border='0' title="Click here to Reset"></chiptrack:restrictedLink>
        </logic:notEqual>
        <%--Ends here -  Gandhi --%>
        <%-- <A href="document.settingForecastForm.reset();"><IMG src="<%=chipTracContext%>/jsp/includes/images/reset.gif" border='0'></A> --%>
        <%--Modified by varma(29 jun 2004) --%>
        <%-- Commented by Gandhi on 4th Aug 2004 --%>
        <%-- <a href="javascript:document.settingForecastForm.reset();"><img src="<%=chipTracContext%>/jsp/includes/images/reset.gif" border='0' onmouseover="window.status='Click to Reset';return true" onmouseout="window.status='';return true" title="Click here to Reset"></a> --%>
        <%--Ends here -  Gandhi --%>
        <%-- Added by Veeru on 22nd July 2004 --%>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <logic:equal name="settingForecastForm" property="showMkgForecast" value="on">
            <a href="<%=chipTracContext%>/settingForecast.do?marketing=on" onmouseover="window.status='Click to Cancel Forecast';return true" onmouseout="window.status='';return true" title="Click here to Cancel Forecast"><img src="<%=chipTracContext%>/jsp/includes/images/cancel.gif" border='0'></a>
        </logic:equal>
        <logic:notEqual name="settingForecastForm" property="showMkgForecast" value="on">
            <a href="<%=chipTracContext%>/settingForecast.do" onmouseover="window.status='Click to Cancel Forecast';return true" onmouseout="window.status='';return true" title="Click here to Cancel Forecast"><img src="<%=chipTracContext%>/jsp/includes/images/cancel.gif" border='0'></a>
        </logic:notEqual>
    </td></tr>
    <tr><td colspan=5><IMG height=20 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=1></td></tr>

</table>
<input type="hidden" name="action" value="">
<input type="hidden" name="marketing" value="<%=request.getParameter("marketing")%>">
<html:hidden name="settingForecastForm" property="customer"/>
<html:hidden name="settingForecastForm" property="product" />
<html:hidden name="settingForecastForm" property="startMonth" />
<html:hidden name="settingForecastForm" property="year" />
<html:hidden name="settingForecastForm" property="monthCount" />
<html:hidden name="settingForecastForm" property="endUser" />

</html:form>

<!-- till here -->

<BR><BR><BR></TD>
<TD bgcolor="#ffffff"><IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=1></TD>
</TR>
</TABLE>
<!-- Footer starts here -->

<%@ include file="/jsp/includes/footer.jsp" %>

<!-- footer end here -->

</BODY>
</HTML>
